#include <bits/stdc++.h>

using namespace std;

const int maxn=55;
typedef long long ll;

ll a[maxn],e[maxn],r[maxn],v[maxn],w[10];

ll mod;
inline ll qpow(ll base,ll exp){
    //printf("base=%lld,exp=%lld\n",base,exp);
    ll ans=1;
    while(exp){
        if(exp&1) ans=ans*base%mod;
        base=base*base%mod;
        exp>>=1;
    }
    //printf("ans=%lld,mod=%lld\n",ans,mod);
    return ans;
}

inline int decomp(ll k){
    memset(a,0,sizeof a);
    memset(e,0,sizeof e);
    int cnt;
    cnt=0;
    for(ll i=2;i*i<=k;i++){
        if(k%i) continue;
        a[cnt]=i;e[cnt]=1;r[cnt]=i;
        k/=i;
        while(!(k%i)) e[cnt]++,k/=i,r[cnt]*=i;
        cnt++;
    }
    if(k!=1) a[cnt]=r[cnt]=k,e[cnt++]=1;
    return cnt;
}

ll fac(ll n,ll &exp,const int &k){
    if(n==0||n==1) return 1;
    ll t,ans,q;
    t=n/a[k];
    //printf("t=%lld\n",t);
    exp+=t;
    ans=1;
    for(ll i=1;i<r[k];i++){
        if(i%a[k]==0) continue;
        ans=ans*i%mod;
    }
    ans=qpow(ans,n/r[k]);
    q=n%r[k];
    for(ll i=1;i<=q;i++){
        if(i%a[k]==0) continue;
        ans=ans*i%mod;
    }
    ans=ans*fac(t,exp,k)%mod;
    //printf("n=%lld,exp=%lld\n",n,exp);
    return ans;
}

ll exgcd(const ll &a,const ll &b,ll &x,ll &y){
    if(b){
        ll ans=exgcd(b,a%b,x,y);
        ll t=x;x=y;y=t-a/b*y;
        return ans;
    }else{
        x=1;y=0;
        return a;
    }
}

ll ine(const ll &a){
    ll x,y;
    ll g=exgcd(a,mod,x,y);
    if(g!=1) return -1;
    return (x%mod+mod)%mod;
}

ll crt(const int &n,const ll &p){
    ll ans=0;
    for(int i=0;i<n;i++){
        ll t=v[i];
        t=t*(p/r[i])%p;
        mod=r[i];
        t=t*ine(p/r[i])%p;
        ans+=t;
        ans%=p;
    }
    return ans;
}

int main(){
    ll p;
    int n,m,cnt;

    ios::sync_with_stdio(false);
    cin>>p>>n>>m;
    w[m]=n;
    for(int i=0;i<m;i++) cin>>w[i],w[m]-=w[i];
    if(w[m]<0) {puts("Impossible"); return 0;}
    else if(w[m]==0) m--;

    cnt=decomp(p);
    for(int i=0;i<cnt;i++){
        ll exp=0,ex=0;
        mod=r[i];
        v[i]=fac(n,exp,i);
        for(int j=0;j<=m;j++){
            v[i]=v[i]*ine(fac(w[j],ex,i))%mod;
        }
        exp-=ex;
        v[i]=v[i]*qpow(a[i],exp)%mod;
    }
    cout<<crt(cnt,p)<<endl;
}
